with Ada.Text_IO; use Ada.Text_IO;
with AUnit.Assertions;
with Constants;
with Ada.Containers; use Ada.Containers;
package body Stations.Test is

   procedure Register_Tests (T : in out Test_S1) is
      use Test_Cases.Registration;
   begin
      Register_Routine (T, Test_Name'Access, "Test Stations getName");
      Register_Routine (T, Is_Train'Access, "Test Stations comeTrain");
      Register_Routine (T, Leave_Station'Access, "Test Stations leaveTrain");
      Register_Routine (T, Add_Passenger'Access, "Test Stations add");
   end Register_Tests;

   function Name (T : Test_S1) return Test_String is
   begin
      return Format ("Test Stations");
   end Name;

--    ----------------------
-- Test routines
--    ----------------------

   procedure Test_Name (T : in out Test_Cases.Test_Case'Class) is
      Expected : Standard.String := "'A'";
      station_name : constant Constants.StationType :=
        	Constants.StationType'First;
      station : Stations.Station;
   begin
      Put_Line ("Test_Name_Station");
      station.create (station_name);
      AUnit.Assertions.Assert (Condition => (station.getName = Expected),
                               Message => "Test getName() function fails."
        &" Expected: "&Expected &", function getName: "&station.getName);
   end Test_Name;

   procedure Is_Train (T : in out Test_Cases.Test_Case'Class) is
      Expected : Boolean := true;
      station : Stations.Station;
      station_name : constant Constants.StationType :=
        	Constants.StationType'First;
   begin
      station.create (station_name);
      station.comeTrain;
      AUnit.Assertions.Assert ( Condition => (station.isTrain = Expected),
                               Message => "Test comeTrain() procedure fails.");
   end Is_Train;

   procedure Leave_Station (T : in out Test_Cases.Test_Case'Class) is
      Expected : Boolean := false;
      station : Stations.Station;
      station_name : constant Constants.StationType :=
        Constants.StationType'First;
      q : Passengers_Container.Vector;
   begin
      station.create (station_name);
      station.comeTrain;
      station.leaveTrain (q);
      AUnit.Assertions.Assert ( Condition => (station.isTrain = Expected),
                               Message => "Test leaveTrain() procedure fails.");
   end Leave_Station;

   procedure Add_Passenger (T : in out Test_Cases.Test_Case'Class) is
      Expected : Count_Type := 1;
      station : Stations.Station;
      station_name : constant Constants.StationType :=
        Constants.StationType'First;
      q : Passengers_Container.Vector;
      p_id : Constants.PassengerId;
   begin
      station.create (station_name);
      station.add (p_id);
      station.leaveTrain (q);
      AUnit.Assertions.Assert ( Condition => (q.Length = Expected),
                               Message => "Test add() procedure fails.");
   end Add_Passenger;
end Stations.Test;
